Completed
Push — master ( 8c53f9...1d869a )
by Marcelo
33s
created

publish.spec.js ➔ ... ➔ ???   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 1
c 3
b 0
f 0
nc 1
dl 0
loc 26
rs 8.8571
nop 0
1
import { expect } from 'chai';
2
import { createCustomStream } from './helper';
3
4
describe('publish.js', () => {
5
    describe('Custom environment', () => {
6
        it('should refuse malformed URL', () => {
7
            const stream = createCustomStream({ RUNG_API: 'foo' }, ['publish']);
8
            const next = (text = '') => stream.write(`${text}\r`)
9
                    .then(() => stream.once('data'));
10
11
            return stream.once('data')
12
                .then(output => {
13
                    expect(output).to.match(/Warning: invalid API for Rung: "foo"/);
14
                    return stream.once('data');
15
                })
16
                .then(output => {
17
                    expect(output).to.match(/Rung email/);
18
                    return next('[email protected]');
19
                })
20
                .then(output => {
21
                    expect(output).to.match(/Rung password/);
22
                    return next('my_super_secure_password_rsrs');
23
                })
24
                .then(output => {
25
                    console.log(output);
26
                    return stream.once('data');
27
                })
28
                .finally(stream.close);
29
        }).timeout(15000);
30
    });
31
});